/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxline.model;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;

/**
 *
 * @author roniere
 */
@Entity
public class ValueInterestParcel implements Serializable {

    @Id
    @SequenceGenerator(sequenceName = "seq_value_interest_parcel", name = "seq_value_interest_parcel", allocationSize = 1)
    @GeneratedValue(generator = "seq_value_interest_parcel", strategy = GenerationType.SEQUENCE)
    private Long id;
    
    @OneToOne
    private InterestParcel interestParcel;
    
    @Column
    @DecimalMin( value = "0.00" )
    private BigDecimal value;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public InterestParcel getInterestParcel() {
        return interestParcel;
    }

    public void setInterestParcel(InterestParcel interestParcel) {
        this.interestParcel = interestParcel;
    }

    public BigDecimal getValue() {
        return value;
    }

    public void setValue(BigDecimal value) {
        this.value = value;
    }

    public ValueInterestParcel(InterestParcel interestParcel, BigDecimal value) {
        this.interestParcel = interestParcel;
        this.value = value;
    }

    public ValueInterestParcel() {
    }

    @Override
    public String toString() {
        return "ValueInterestParcel{" + "id=" + id + ", interestParcel=" + interestParcel + ", value=" + value + '}';
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ValueInterestParcel other = (ValueInterestParcel) obj;
        if(!getId().equals(other.getId())){
         return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }
    
    
}
